Skip to content

Add comprehensive unit tests for models, services, and config (179 tests)#2

Closed
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1783059486-add-unit-tests
Closed

Add comprehensive unit tests for models, services, and config (179 tests)#2
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1783059486-add-unit-tests

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

The repo had zero test coverage — no test/ directory existed. This PR adds 179 unit tests across 5 test files covering the most testable (pure logic) modules:

File What's tested # tests
test/models_test.dart JsonUtils (all 6 methods with type coercion, fallback keys, defaults), ApiResponse.fromJson (standard/alt keys, success bool, non-map input), all model fromJson/toJson roundtrips: MeritDemeritRecord, AbsenceRecord, AttendanceStatistics, AttendanceTotals, CourseSchedule, CourseInfo, SemesterGrade, SubjectGrade, TotalScore, DailyPerformance, GradeData, ExamMenuItem, ExamSubjectScore, ExamSummary, StudentInfo, TimetableEntry, TimetableData, SubjectAbsence, NoticeItem, VocPassUser, VocPassPublicUser, Restaurant, RestaurantEvaluation, RestaurantMenu, PeriodTime, CourseExtra ~95
test/forum_models_test.dart ForumUser, ForumPost (tag parsing/sorting, likeTargetID, imageURLs, isLikedBy), ForumMessage, ForumPostListData, ForumMessageListData, ForumAdminInfo ~35
test/w2m_models_test.dart W2MUserInfo, W2MEventSummary, W2MEventListResponse, W2MEvent (dates, slotCount, usersAvailable, maxCount), W2MUserAvailability, W2MSlot (equality/hashCode), w2mDisplayTimes(), w2mShortDate() ~25
test/html_parser_test.dart HtmlParser.parseExamScores — student ID extraction, exam info, table row parsing, HTML entity decoding (&, A, B,  , <, etc.), nested tag stripping ~12
test/school_config_test.dart SchoolConfig (fromJson/fromApi/toJson/fromJsonString roundtrips, isGuest, loginUrl, loginedUrl), LoginConfig (captcha image parsing, success keywords from list/string), UrlConfig, RouteConfig, NoticeConfig, FieldConfig, ButtonConfig, CaptchaImageConfig ~25

All tests verify both the primary JSON keys and alternative/fallback keys that the models support.

Link to Devin session: https://app.devin.ai/sessions/a1315cec34014a0aadbe8cb129e3372c
Requested by: @HansHans135

… school_config

179 tests covering:
- JsonUtils (readString, readInt, readBool, readStringList, readStringMap)
- ApiResponse parsing with multiple key formats
- All model fromJson/toJson: MeritDemeritRecord, AbsenceRecord,
  AttendanceStatistics, CourseSchedule, CourseInfo, SubjectGrade,
  SemesterGrade, TotalScore, DailyPerformance, GradeData, ExamMenuItem,
  ExamSubjectScore, ExamSummary, StudentInfo, TimetableEntry, TimetableData,
  SubjectAbsence, NoticeItem, VocPassUser, VocPassPublicUser, Restaurant,
  RestaurantEvaluation, RestaurantMenu, PeriodTime, CourseExtra
- ForumUser, ForumPost, ForumMessage, ForumPostListData,
  ForumMessageListData, ForumAdminInfo
- W2MUserInfo, W2MEventSummary, W2MEventListResponse, W2MEvent,
  W2MUserAvailability, W2MSlot, w2mDisplayTimes, w2mShortDate
- HtmlParser.parseExamScores with HTML entity decoding
- SchoolConfig, LoginConfig, UrlConfig, RouteConfig, NoticeConfig,
  FieldConfig, ButtonConfig, CaptchaImageConfig

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@HansHans135 HansHans135 self-assigned this Jul 3, 2026
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant